package com.printer.printerexample;

import android.content.Context;
import android.graphics.Bitmap;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.printer.printerexample.entry.InventoryDetail;


public class PurchasePrint extends LinearLayout {

    public void setPrintText(Context context, InventoryDetail details, Bitmap b1) {
        if(details==null){
            return;
        }
        ((TextView) findViewById(R.id.id_textview)).setText(details.getMaterialID()+"");
        ((ImageView) findViewById(R.id.MaterialBarcode_iv)).setImageBitmap(b1);
        ((TextView) findViewById(R.id.MaterialName_text)).setText(details.getMaterialName());
        ((TextView) findViewById(R.id.Model_edt)).setText(details.getModel());
        ((TextView) findViewById(R.id.unit_edt)).setText(details.getUnit());
        ((TextView) findViewById(R.id.UnitPrice_edt)).setText(details.getUnitPrice());
        ((TextView) findViewById(R.id.WarehouseNumber_edt)).setText(details.getWarehouseNumber());


        ((TextView) findViewById(R.id.HighestNumber_edt)).setText(details.getHighestQuota());
        ((TextView) findViewById(R.id.LowestNumber_edt)).setText(details.getLowestQuota());

    }



    public PurchasePrint(Context context) {
        this(context, null);
    }

    public PurchasePrint(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public PurchasePrint(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        LayoutInflater.from(context).inflate(R.layout.purches_print_detail_card, this, true);
    }

}